<h1>Results</h1>

<p>
<h3><%= link_to 'Runs', runs_path %></h3>
<p>
<%= render(:partial => 'shared/passfail_summary',
:locals => { 
:passed => @passed,
:failed => @failed,
:total => @total
}) %>


<table border>
  <tr>
    <th>
      <font size="2">Name</font>
      <font size="1"><%= link_to( '^', results_path( :order => :name, :latest => Result.latest, :name => Result.test_name, :run_id => Result.run_id, :direction => 'asc' ) ) %></font>
      <font size="1"> <%= link_to( 'v', results_path( :order => :name, :latest => Result.latest, :name => Result.test_name, :run_id => Result.run_id, :direction => 'desc' ) ) %></font>
    </th>
     <th>      
      <font size="2">Result</font>
      <font size="1"><%= link_to( '^', results_path( :order => :passed, :latest => Result.latest, :name => Result.test_name, :run_id => Result.run_id, :direction => 'asc' ) ) %></font>
      <font size="1"> <%= link_to( 'v', results_path( :order => :passed, :latest => Result.latest, :name => Result.test_name, :run_id => Result.run_id, :direction => 'desc' ) ) %></font>
    </th>
     <th>      
      <font size="2">Run ID</font>
      <font size="1"><%= link_to( '^', results_path( :order => :run_id, :latest => Result.latest, :name => Result.test_name, :run_id => Result.run_id, :direction => 'asc' ) ) %></font>
      <font size="1"> <%= link_to( 'v', results_path( :order => :run_id, :latest => Result.latest, :name => Result.test_name, :run_id => Result.run_id, :direction => 'desc' ) ) %></font>
    </th>
    <th>Message</th>
     <th>    
      <font size="2">Created At</font>
      <font size="1"><%= link_to( '^', results_path( :order => :created_at, :latest => Result.latest, :name => Result.test_name, :run_id => Result.run_id, :direction => 'asc' ) ) %></font>
      <font size="1"> <%= link_to( 'v', results_path( :order => :created_at, :latest => Result.latest, :name => Result.test_name, :run_id => Result.run_id, :direction => 'desc' ) ) %></font>
    </th>
    <th>Show</th>
    <th>Edit</th> 
    <th>Delete</th>
  </tr>

<% @results.each do |result| %>
<tr valign="top" class= "<%= cycle('list-line-odd', 'list-line-even') %>">
    <td><%=h result.name %></td>
    <td><%=h result.passed %></td>
    <td><%=h result.run_id %></td>
    <td><%=h result.message %></td>
    <td><%=h result.created_at %></td>
    <td><%= link_to 'Show', result %></td>
    <td><%= link_to 'Edit', edit_result_path(result) %></td> 
    <td><%= link_to 'Delete', result, :confirm => 'Are you sure?', :method => :delete %></td>
  </tr>
<% end %>
</table>
<p>

<br />
<hr />
<br />
Usage:
<br />
<table border>
  <tr><th>Parameters</th><th>Description</th></tr>
  <tr><td>'/results?name=[NAME]' </td><td> show all results by test name</td>  </tr>
  <tr><td>'/results?name=[NAME]&latest' </td><td> show the latest result(s) by test name</td>  </tr>
  <tr><td></td>  </tr>
  <tr><td>'/results?run_id=[RUN_ID]' </td><td> show all results by run_id</td>  </tr>
  <tr><td>'/results?run_id=[RUN_ID]&latest' </td><td> show the latest result(s) by run_id</td>  </tr>
  <tr><td></td>  </tr>
  <tr><td>'/results?name=[NAME]&run_id=[RUN_ID]' </td><td> show all results by test name and run_id</td>  </tr>
  <tr><td>'/results?name=[NAME]&run_id=[RUN_ID]&latest' </td><td> show the latest result(s) by test name and run_id</td>  </tr>
</table>

<!-- <%= link_to 'New result', new_result_path %> -->